<?php

namespace App\Http\Controllers\Front;

use App\Models\AdvContent;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;

class AdvController extends Controller
{

    /**
     * 获得广告位信息
     * @param Request $request
     * @return array
     */
    public function ajax_get_adv_info(Request $request)
    {
        $pagesize = $request->pagesize;
        $advTypeId = $request->adv_type_id;
        $advContentId = $request->adv_content_id;

        if ($advTypeId) {
            $advContent = AdvContent::getAdvContent($advTypeId, $pagesize);
        } else if ($advContentId) {
            $advContent = AdvContent::getAdvContent(0, 1, 0, $advContentId);
        }

        return ajaxSuccess('成功', $advContent);
    }
}
